-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user locale/region setting #5623
Conversation
@tcitworld, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nickvergessen, @rullzer and @LukasReschke to be potential reviewers. |
return $userLocaleString === $value['code']; | ||
}); | ||
|
||
if (count($userLocale) > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!empty()
@@ -314,3 +315,29 @@ | |||
</a> | |||
</form> | |||
<?php } ?> | |||
|
|||
<form id="locale" class="section"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move above the closing bracket? You don't need the dropdown when you can't save it.
</option> | ||
<?php endforeach;?> | ||
</select> | ||
</form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line
lib/private/L10N/Factory.php
Outdated
@@ -111,7 +112,7 @@ public function get($app, $lang = null) { | |||
|
|||
if (!isset($this->instances[$lang][$app])) { | |||
$this->instances[$lang][$app] = new L10N( | |||
$this, $app, $lang, | |||
$this, $app, $lang, $locale, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locale is not filled with the users config?!
I disagree. This should happen automatically. It should automatically pick up the user's config and use that localle if none was given explicit, just like with the language. The cases where we set the language explicit are a different story of course, but there shouldn't be a lot. |
Codecov Report
@@ Coverage Diff @@
## master #5623 +/- ##
=============================================
+ Coverage 31.71% 51.98% +20.26%
- Complexity 26010 26037 +27
=============================================
Files 1661 1661
Lines 96137 96230 +93
Branches 1290 1290
=============================================
+ Hits 30494 50026 +19532
+ Misses 65643 46204 -19439
|
Ideally core apps would just use momentJS and we set moment.locale($locale) in core.js |
Done. |
AFAIK you can simply update the locale with |
How did you acquire the data for Is there an automated way to update it? |
@tcitworld Could you please resolve the conflict? Thanks 👍 |
a79e02d
to
286ac1d
Compare
Yeah, don't really know why.
Meaning ?
Originally stolen from https://gist.github.com/jacobbubu/1836273, but I've found newer versions at https://gist.github.com/jasef/337431c43c3addb2cbd5eb215b376179 and https://gist.github.com/ndbroadbent/588fefab8e0f1b459fcec8181b41b39c I guess it could be retrieved from elsewhere (for instance Debian has a languages code list at
Fixed. |
Any progress on this? Currently biding my time using en_GB as a language+locale setting, but having the option to choose both would be nice. |
@tcitworld What's the current state? :) |
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
fbeac9c
to
8c73b13
Compare
It's done from a coding point of view imho. Just the layouting fixes :) |
lib/public/IL10N.php
Outdated
* * The code (en_US, fr_CA, ...) of the locale that is used for this IL10N object | ||
* | ||
* @return string locale | ||
* @since 13.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14 ;)
lib/public/L10N/IFactory.php
Outdated
/** | ||
* @param string|null $lang user language as default locale | ||
* @return string locale If nothing works it returns 'en_US' | ||
* @since 13.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14 ;)
lib/public/L10N/IFactory.php
Outdated
* | ||
* @param string $string | ||
* @return string Unique function name | ||
* @since 9.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this especially ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works 👍 (beside the little nitpicks the code looks good as well)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Fixed the docblock since mistakes |
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Does this also introduces a way for an admin to set the DEFAULT locale/region? Let's say you create a new user. EDIT: I see, this is not an GUI option set. I think the only way is to set defaults within the config file. Correct? |
Ps. Also update the docs? https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/language_configuration.html?highlight=language# with the new |
Yup, just like for the language. |
@tcitworld can you provide a pr for the docs ? :) |
This PR allows having a dedicated user locale/region setting. See #1781
Needs :